<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
    String path = request.getContextPath();
%>

<style type="text/css">
    table tbody {
        display:block;
        height:420px;
        overflow-y:scroll;
    }

    table thead, tbody tr {
        display:table;
        width:100%;
        table-layout:fixed;
    }

</style>

<link href="<%=path%>/static/css/all.css" rel="stylesheet" type="text/css">
<!--[if IE]>
<script>
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
</script>
<![endif]-->
<jsp:include page="/web/inc/header"/>
<section>
    <div class="wrap">
        <div class="section">
            <article id="datalist">

            </article>
            <aside>
                <div class="top">
                    <h3>用户中心</h3>
                </div>
                <ul>
                    <li><a href="<%=path%>/web/usercenter/usPassport">用户信息</a></li>
                    <li><a href="<%=path%>/web/usercenter/usDatelist">我提供的垃圾</a></li>
                    <li><a href="<%=path%>/web/usercenter/usTexture">我提供的材质</a></li>
                    <li><a href="<%=path%>/web/usercenter/usArticle">我的文章</a></li>
                    <li><a href="<%=path%>/web/usercenter/usQuestions">我的提问</a></li>
                    <li><a href="<%=path%>/web/usercenter/usAnswers">我的回答</a></li>
                    <li><a href="<%=path%>/web/usercenter/usCollect" style="font-weight: 900">我的收藏</a></li>
                </ul>
            </aside></div>
    </div>
</section>
<jsp:include page="/web/inc/footer"/>
<script src="<%=path%>/static/js/jquery-3.3.1.min.js"></script>
<script src="<%=path%>/static/js/layui/layui.all.js"></script>
<script>
    $(function () {
        init(1);
        $("#datalist").on("click",".current",function () {
            var pageNum = $(this).html();
            init(pageNum)
        })
    })

    function init(pageNum){
        $.get("<%=path%>/web/usercenter/collectData",
            {pageNum:pageNum},
            function (data) {
                $("#datalist").html(data)
            }
        )
    }

    function deleteCollect(id,articleName,authorName) {
        $.get("<%=path%>/web/article/collect",
            {id:id,articleName:articleName,authorName:authorName},
            function (data) {
                if(data==true){
                    $("#tr"+id).remove();
                    layer.msg("取消收藏成功",{icon:1})
                }
            }
        )
    }

</script>
